
--[[

    slimui - Copyright (c) 2011 atom0s, All rights reserved.

    See Copyright notice in slimui.lua
    
]]--

class 'ProgressBar: WinControl' { ... };

----------------------------------------------------------------------------------
-- func: ProgressBar.__init__
-- desc: Constructor called when this object is first created.
----------------------------------------------------------------------------------
function ProgressBar.__init__( self )
    WinControl.__init__( self );
end

----------------------------------------------------------------------------------
-- func: ProgressBar:Create
-- desc: Creates a new ProgressBar object.
----------------------------------------------------------------------------------
function ProgressBar:Create( parent )
    if parent == nil or parent._object == nil then
        slimui:err( 'ProgressBar:Create - parent must be set to create a control!' );
    end
    
    self._object = createProgressBar( parent._object );
    
    if self._object == nil then
        slimui:err( 'ProgressBar:Create - failed to initialize a new object.' );
    end
    
    return self;
end

----------------------------------------------------------------------------------
-- func: ProgressBar:StepIt
-- desc: Steps this progressbar ahead by one.
----------------------------------------------------------------------------------
function ProgressBar:StepIt( )
    progressbar_stepIt( self._object );
end

----------------------------------------------------------------------------------
-- func: ProgressBar:StepBy
-- desc: Steps this progressbar by the given delta.
----------------------------------------------------------------------------------
function ProgressBar:StepBy( delta )
    progressbar_StepBy( self._object, delta );
end

----------------------------------------------------------------------------------
-- func: ProgressBar:GetMax
-- desc: Returns the max value this progressbar can obtain.
----------------------------------------------------------------------------------
function ProgressBar:GetMax( )
    return progressbar_getMax( self._object );
end

----------------------------------------------------------------------------------
-- func: ProgressBar:SetMax
-- desc: Sets the max value this progressbar can obtain.
----------------------------------------------------------------------------------
function ProgressBar:SetMax( max )
    progressbar_setMax( self._object, max );
end

----------------------------------------------------------------------------------
-- func: ProgressBar:GetMin
-- desc: Returns the min value this progressbar can obtain.
----------------------------------------------------------------------------------
function ProgressBar:GetMin( )
    return progressbar_getMin( self._object );
end

----------------------------------------------------------------------------------
-- func: ProgressBar:SetMin
-- desc: Sets the min value this progressbar can obtain.
----------------------------------------------------------------------------------
function ProgressBar:SetMin( min )
    progressbar_setMin( self._object, min );
end

----------------------------------------------------------------------------------
-- func: ProgressBar:GetProgress
-- desc: Returns the current progress of this progressbar.
----------------------------------------------------------------------------------
function ProgressBar:GetProgress( )
    return progressbar_getPosition( self._object );
end

----------------------------------------------------------------------------------
-- func: ProgressBar:SetProgress
-- desc: Sets the current progress of this progressbar.
----------------------------------------------------------------------------------
function ProgressBar:SetProgress( progress )
    progressbar_setPosition( self._object, progress );
end



--[[ Debug information. ]]--------------------------------------------------------
if ( slimui:isdebug() == true ) then
    slimui:msg( '(Control) progressbar.lua successfully loaded.' );
end